<HTML><HEAD><TITLE>bag_erase(+BagHandle)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Non-logical Variables, Arrays, Bags, Shelves and Stores</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>bag_erase(+BagHandle)</H1>
Erase the contents of a bag
<DL>
<DT><EM>BagHandle</EM></DT>
<DD>A bag handle
</DD>
</DL>
<H2>Description</H2>
	This explicitly erases the contents of a previously created
	bag object and frees the associated memory. After erasing,
	the bag is in the same state as immediately after creation,
	and can be filled with new contents.
    
<H3>Modes and Determinism</H3><UL>
<LI>bag_erase(+) is det
</UL>
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>BagHandle is not instantiated
<DT><EM>(5) type error </EM>
<DD>BagHandle is not a bag
<DT><EM>(40) stale object handle </EM>
<DD>BagHandle refers to an already destroyed bag
</DL>
<H2>Examples</H2>
<PRE>
    ?- bag_create(B), bag_enter(B, one), bag_erase(B), bag_enter(B, two), bag_retrieve(B, L).
    B = 'BAG'(16'0030db60)
    L = [two]
    Yes (0.00s cpu)
    </PRE>
<H2>See Also</H2>
<A HREF="../../kernel/storage/bag_create-1.html">bag_create / 1</A>, <A HREF="../../kernel/storage/bag_abolish-1.html">bag_abolish / 1</A>, <A HREF="../../kernel/storage/bag_enter-2.html">bag_enter / 2</A>, <A HREF="../../kernel/storage/bag_count-2.html">bag_count / 2</A>, <A HREF="../../kernel/storage/bag_retrieve-2.html">bag_retrieve / 2</A>, <A HREF="../../kernel/storage/bag_dissolve-2.html">bag_dissolve / 2</A>
</BODY></HTML>
